package com.bjesc_b2c.app.appraiset.widget.popupwindow;

import android.content.Context;
import android.content.Intent;
import android.view.View;

import com.bjesc_b2c.app.appraiset.R;
import com.bjesc_b2c.app.appraiset.mvp.view.activity.CarFrameworkImageActivity;
import com.bjesc_b2c.app.appraiset.mvp.view.activity.CarOrnamentsItemActivity;
import com.bjesc_b2c.app.appraiset.mvp.view.activity.CarSourceActivity;
import com.bjesc_b2c.app.appraiset.mvp.view.activity.CarSurfaceItemActivity;
import com.bjesc_b2c.app.appraiset.mvp.view.activity.ComprehensiveEvaluationActivity;
import com.bjesc_b2c.app.appraiset.mvp.view.activity.DeviceActivity;
import com.bjesc_b2c.app.appraiset.mvp.view.activity.PhotographsActivity;
import com.bjesc_b2c.app.appraiset.widget.BasePopupWindow;

/**
 * Created by Jason Chen on 2017/2/21.
 */

public class BasicDropDownPop extends BasePopupWindow implements View.OnClickListener {


    public BasicDropDownPop(Context context, View.OnClickListener listener) {
        super(context, listener);
    }

    @Override
    protected void initViews() {
        view = inflater.inflate(R.layout.popup_basic_pull, null);
        if(listener==null){
            view.findViewById(R.id.rlty_car_form).setOnClickListener(this);
            view.findViewById(R.id.rlty_car_Framework).setOnClickListener(this);
            view.findViewById(R.id.rlty_car_appearance).setOnClickListener(this);
            view.findViewById(R.id.rlty_car_interior).setOnClickListener(this);
            view.findViewById(R.id.rlty_car_damage).setOnClickListener(this);
            view.findViewById(R.id.rlty_car_comprehensive).setOnClickListener(this);
            view.findViewById(R.id.rlty_car_photo).setOnClickListener(this);
        }else{
            view.findViewById(R.id.rlty_car_form).setOnClickListener(listener);
            view.findViewById(R.id.rlty_car_Framework).setOnClickListener(listener);
            view.findViewById(R.id.rlty_car_appearance).setOnClickListener(listener);
            view.findViewById(R.id.rlty_car_interior).setOnClickListener(listener);
            view.findViewById(R.id.rlty_car_damage).setOnClickListener(listener);
            view.findViewById(R.id.rlty_car_comprehensive).setOnClickListener(listener);
            view.findViewById(R.id.rlty_car_photo).setOnClickListener(listener);
        }
        view.findViewById(R.id.root).setOnClickListener(this);
    }

    @Override
    protected int setRootViewId() {
        return R.id.root;
    }


    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.rlty_car_form:        //车源图片
                context.startActivity(new Intent(context, CarSourceActivity.class));
                dismiss();
                break;
            case R.id.rlty_car_Framework:   //骨架
                context.startActivity(new Intent(context, CarFrameworkImageActivity.class));
                break;
            case R.id.rlty_car_appearance:  //外观
                context.startActivity(new Intent(context,CarSurfaceItemActivity.class));
                break;
            case R.id.rlty_car_interior:    //内饰
                context.startActivity(new Intent(context, CarOrnamentsItemActivity.class));
                break;
            case R.id.rlty_car_damage:      //配置
                context.startActivity(new Intent(context, DeviceActivity.class));
                break;
            case R.id.rlty_car_comprehensive:   //综合评估
                context.startActivity(new Intent(context, ComprehensiveEvaluationActivity.class));
                dismiss();
                break;
            case R.id.rlty_car_photo:       //合影
                context.startActivity(new Intent(context, PhotographsActivity.class));
                break;
            case R.id.root:
                break;
        }
    }
}
